package com.own.constant;

import java.io.Serializable;
import java.util.function.Function;

/**
 * ConstantConvert
 *
 * @author chenxueli
 * @date 2024-01-23 09:08:00
 */
public final class ConstantConvert implements Serializable {

    /**
     * 字符串转字符串
     */
    public static final Function<String, String> STRING_TO_STRING = Function.identity();
    /**
     * 字符串转数字（Integer）
     */
    public static final Function<String, Integer> STRING_TO_INTEGER = Integer::parseInt;
    /**
     * 字符串转数字（Long）
     */
    public static final Function<String, Long> STRING_TO_LONG = Long::parseLong;
    /**
     * 字符串转数字（Short）
     */
    public static final Function<String, Short> STRING_TO_SHORT = Short::parseShort;
    /**
     * 字符串转数字（Byte）
     */
    public static final Function<String, Byte> STRING_TO_BYTE = Byte::parseByte;
    /**
     * 字符串转布尔类型（Boolean）
     */
    public static final Function<String, Boolean> STRING_TO_BOOLEAN = Boolean::parseBoolean;

}
